﻿using System;

namespace _09简单工厂模式
{
    class Program
    {
        static void Main(string[] args)
        {
            string strExit = "y";
            do
            {
                try
                {
                    Console.Write("请输入数字A：");
                    double numberA = double.Parse(Console.ReadLine());

                    Console.Write("请输入操作符号（“+”、“-”、“*”、“/”）：");
                    string strOperate = Console.ReadLine();
                    Console.Write("请输入数字B：");
                    double numberB = double.Parse(Console.ReadLine());
                    var operation = SimpleFactory.CreateOperation(strOperate);
                    operation.NumberA = numberA;
                    operation.NumberB = numberB;
                    Console.WriteLine("结果={0}", operation.GetResult());

                }
                catch (System.FormatException)
                {
                    Console.WriteLine("请提示正确输入数字和操作符！");
                }
                Console.WriteLine("是否继续？（输入“Y”继续，其他键退出）");
                strExit = Console.ReadLine();
            } while (strExit.Equals("y") || strExit.Equals("Y"));
        }

    }
}
    


